<?php
	Class Md_type_product extends CI_Model{
		function get_one_by_id($id){
			$query = $this->db->query("select * from type_aodai where id = $id");
			return $query->result();
		}
		function get_all($is_cond){
			if ($is_cond){
				$query = $this->db->query("select * from type_aodai ta where EXISTS (select id from aodai ad where ad.type = ta.id)");
			}else{
				$query = $this->db->query("select * from type_aodai ");
			}
			
			return $query->result();
		}
		function insert($data){
			$this->db->insert('type_aodai',$data);
			return $this->db->insert_id();
		}
		function update($data,$id){
			$this->db->where('id',$id);
			$this->db->update('type_aodai',$data);
		}
		function delete($ids){
			$this->db->where_in('id',$ids);
			$this->db->delete("type_aodai");
		}
	} 
?>